package com.zzuli.yxypre.controller;

import com.zzuli.yxypre.comment.R;
import com.zzuli.yxypre.service.TopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @auther pony
 * @create 2023-05-12 13:36
 */
@RestController
@RequestMapping("top")
@CrossOrigin(origins = "*")
public class TopController {

    @Autowired
    private TopService topService;

    /**
     * 播放量统计
     * @param songId
     * @return
     */
    @PostMapping("addPlayCount/{songId}")
    public R playCount(@PathVariable("songId") Integer songId){
        return topService.playCount(songId);
    }

    /**
     * 获取飙升榜：每天更新
     * @return
     */
    @GetMapping("soarList")
    public R soarList(HttpServletRequest request){
        return topService.soarList(request);
    }

    /**
     * 获取热歌榜：每周更新
     * @return
     */
    @GetMapping("hotList")
    public R hotList(HttpServletRequest request){
        return topService.hotList(request);
    }

    /**
     * 获取新歌榜：每周更新
     * @return
     */
    @GetMapping("newList")
    public R newList(HttpServletRequest request){
        return topService.newList(request);
    }

    /**
     * 获取播放量前 5 的专辑数据
     * @return
     */
    @GetMapping("getBanner")
    public R getBanner(){
        return topService.getBanner();
    }
}
